Create Modal
New Modal Creation
In this interface, you can create a New Modal which defines the structure and schema for your table. A modal acts as the blueprint for the table's properties, ensuring that the fields are properly defined, along with their data types and constraints. This guide walks you through the different elements of the New Modal interface.
Interface Overview
-
Modal Name:
- This field allows you to specify a name for the modal. The modal name represents the overall schema or entity you are defining.
- Example:
Modal 1
in the image represents a basic modal with fieldsProperty 1
,name
, andage
.
-
Property Name:
- Property names represent the fields (columns) of your modal. Each property will have its own unique name.
- Example:
Property 1
,name
, andage
are the properties in the modal.
-
Data Type:
- Defines the type of data the field will hold. The data type ensures that each property holds data in the correct format.
- Available data types include:
- String: For textual data such as names or descriptions.
- Number: For numeric data such as ages, quantities, or IDs.
- Boolean: For true/false values, commonly used for status flags.
- Any: Accepts any type of data, offering flexibility when the data type is not known or can vary.
- Array: Stores a list of values, often used when a field holds multiple related items.
- Object: Stores key-value pairs, representing more complex structured data.
- BigInt: For very large integers, often used for precise numerical operations that exceed the range of standard
Number
types.
- Example: In the image, the data types are
Boolean
,String
, andNumber
for the respective properties.
-
Properties:
- This section allows you to configure constraints and validation for each field.
- You can add multiple properties to a field such as
Not Null
,Optional
,Relation Key
,Max Value
, andMin Value
.
Property Options Explained:
- Not Null: Ensures that the field cannot have null or empty values.
- Optional: Allows the field to have null or empty values.
- Relation Key: Defines the field as a foreign key, linking it to another table.
- Max Value: Specifies the maximum allowed value for a numeric field.
- Min Value: Specifies the minimum allowed value for a numeric field.
- Example:
- The field
name
hasRelation Key
defined, indicating it's linked to another table. - The field
age
has aMax Value
of 10,Min Value
of 1, and is marked asOptional
but alsoNot Null
, which indicates a flexible configuration for the field's validation.
- The field
-
Add New Property:
- Click this button to add a new field (property) to the modal. This allows you to keep extending the schema by defining additional fields and their properties.
-
Actions Available:
- Save: Saves the modal, applying the defined schema to the table in the database.
- Cancel: Discards changes made to the modal and returns to the previous screen without saving.
Example Modal Configuration:
Modal Name: Employee
Property Name | Data Type | Properties |
---|---|---|
employee_id | Number | Not Null, Auto Increment, Primary Key |
employee_name | String | Not Null |
skills | Array | Optional |
department_id | Number | Relation Key (links to departments table) |
hire_date | Date | Not Null, Optional |
salary_details | Object | Optional, Stores structured key-value data |
is_active | Boolean | Default True |
large_salary | BigInt | Not Null |
Explanation:
- The employee_id field is a unique identifier with
Auto Increment
andPrimary Key
properties. - The department_id field is a foreign key (relation key) that links to the
departments
table. - The skills field is an Array, which allows you to store multiple skills related to the employee.
- The salary_details field is an Object, which stores structured data like salary breakdown (e.g., base salary, bonuses).
- The large_salary field is of type BigInt, which is used for very large numbers, ensuring accuracy for large salary amounts.
Benefits of Using Different Data Types:
- String: Ideal for storing textual information like names and addresses.
- Number: Perfect for numeric values, IDs, and quantities.
- Boolean: Simplifies managing flags like
is_active
, which can either betrue
orfalse
. - Any: Offers flexibility in cases where data types are uncertain or dynamic.
- Array: Useful when you need to store multiple values related to a single field (e.g., multiple skills, tags).
- Object: Allows you to store complex data as key-value pairs (e.g., employee's salary breakdown).
- BigInt: Ensures accurate calculations and storage for very large numbers, exceeding the limit of standard
Number
types.
This modal creation interface simplifies the process of defining database schemas with comprehensive options for field types and validation, ensuring flexibility, data integrity, and ease of management.